/*! * gov.cy UDS v1.0.2 */ var GOVCY=function(e){"use strict";class t{constructor(){}static init(e){document.addEventListener("DOMContentLoaded",(()=>{const t=document.querySelectorAll(e);t&&t.forEach((e=>{new this(e)}))}))}}const a="show",n="collapse",s="collapsed";class r extends t{constructor(e){if(super(),!e)return;const t=document.querySelector(e.dataset.govcyTarget);t&&(this.srcElement=e,this.targetElement=t,this.srcElement.addEventListener("click",(e=>{e.preventDefault(),this._toggle()})))}_toggle(){this._isCollapsed()?this._expand():this._collapse()}_expand(){this.srcElement.classList.remove(s),this.srcElement.setAttribute("aria-expanded",!0),this.targetElement.classList.add(n),this.targetElement.classList.add(a)}_collapse(){this.srcElement.classList.add(s),this.srcElement.setAttribute("aria-expanded",!1),this.targetElement.classList.add(n),this.targetElement.classList.remove(a)}_isCollapsed(){return this.srcElement.classList.contains(s)}}r.init(".govcy-accordion-button");const i="chars";class o extends t{constructor(e){if(super(),!e)return;if(!e.previousElementSibling&&"TEXTAREA"!==e.previousElementSibling.nodeName)return;this.element=e,this.elementToCount=this.element.previousElementSibling;const t=[...this.element.getElementsByTagName("span")];t&&t.length&&(this.counters=t,this.maxCount=100,this.whatToCount=i,this.element.hasAttribute("data-maxchars")&&(this.maxCount=Number.parseInt(this.element.dataset.maxchars,10),this.whatToCount=i),this.element.hasAttribute("data-maxwords")&&(this.maxCount=Number.parseInt(this.element.dataset.maxwords,10),this.whatToCount="words"),this._updateCounters(),this.elementToCount.addEventListener("keyup",(()=>{this._updateCounters()})))}_maxCount(){return this.maxCount}_currentCount(){return this.whatToCount==i?this.elementToCount.value.length:this.elementToCount.value.split(" ").length-1}_updateCounters(){let e=this._maxCount()-this._currentCount();const t=this.element.querySelector(".govcy-character-remaining-counter"),a=this.element.querySelector(".govcy-character-more-counter");this.counters.forEach((t=>{t.innerText=Math.abs(e)})),t&&(t.style.display=e<0?"none":"block"),a&&(a.style.display=e>=0?"none":"block"),e<0?this.elementToCount.classList.add("govcy-text-area-error"):this.elementToCount.classList.remove("govcy-text-area-error")}}o.init(".govcy-character-count");const l="show",c="collapse";class d extends t{constructor(e){super(),e&&(this.srcElement=e,this.srcElement.addEventListener("click",(()=>{this._toggle()})))}_toggle(){const e=document.querySelector(this.srcElement.dataset.govcyTarget);e&&(this.targetElement=e,this._isCollapsed()?this._expand():this._collapse())}_expand(){this.srcElement.setAttribute("aria-expanded",!0),this.targetElement.classList.add(c),this.targetElement.classList.add(l)}_collapse(){this.srcElement.setAttribute("aria-expanded",!1),this.targetElement.classList.add(c),this.targetElement.classList.remove(l)}_isCollapsed(){return this.srcElement.classList.contains("collapsed")}}d.init(".govcy-collapsable");const h={_entity:/[&<>"'/]/g,_entities:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},getEntity:function(e){return h._entities[e]},escapeHTML:function(e){for(var t="",a=0;a1?t-1:0),n=1;ne.map((e=>e+":not([disabled])")).join(", "),we=Le(de,he,`.${H}`,`.${q}`,ue,me,le),$e=Le(Ee),Ye=Le(pe,De,ve);class _e extends t{constructor(e){super(),e&&(this.el=e,this.detectLocale(),this.enhanceDatePicker(e))}enhanceDatePicker(e){const t=e.closest(ae),{defaultValue:a}=t.dataset,n=t.querySelector("input");if(!n)throw new Error(`${ae} is missing inner input`);n.value&&(n.value="");const s=this.parseDateString(t.dataset.minDate||n.getAttribute("min"));t.dataset.minDate=s?this.formatDate(s):"0000-01-01";const r=this.parseDateString(t.dataset.maxDate||n.getAttribute("max"));r&&(t.dataset.maxDate=this.formatDate(r));const i=document.createElement("div");i.classList.add(g);const o=n.cloneNode();o.classList.add(y),o.type="text",i.appendChild(o),i.insertAdjacentHTML("beforeend",h.escapeHTML`
`),n.setAttribute("aria-hidden","true"),n.setAttribute("tabindex","-1"),n.style.display="none",n.classList.add(D),n.removeAttribute("id"),n.removeAttribute("name"),n.required=!1,n.setAttribute("hidden",""),t.appendChild(i),t.classList.add(b),a&&this.setCalendarValue(t,a),n.disabled&&(this.disable(t),n.disabled=!1),this.datePickerEvents(e)}detectLocale(){"undefined"!=typeof govcyDatePickerLocale&&(Me=govcyDatePickerLocale.monthLabels,Se=govcyDatePickerLocale.daysOfWeekLabels,xe=govcyDatePickerLocale.daysOfWeekLabelsShort)}getDatePickerContext(e){const t=e.closest(ae);if(!t)throw new Error(`Element is missing outer ${ae}`);const a=t.querySelector(se),n=t.querySelector(re),s=t.querySelector(ie),r=t.querySelector(ne),i=t.querySelector(oe),o=t.querySelector(be),l=this.parseDateString(n.value,Ae,!0),c=this.parseDateString(a.value),d=this.parseDateString(s.dataset.value),h=this.parseDateString(t.dataset.minDate),u=this.parseDateString(t.dataset.maxDate),m=this.parseDateString(t.dataset.rangeDate),g=this.parseDateString(t.dataset.defaultDate);if(h&&u&&h>u)throw new Error("Minimum date cannot be after maximum date");return{calendarDate:d,minDate:h,toggleBtnEl:r,selectedDate:c,maxDate:u,firstYearChunkEl:o,datePickerEl:t,inputDate:l,internalInputEl:a,externalInputEl:n,calendarEl:s,rangeDate:m,defaultDate:g,statusEl:i}}disable(e){const{externalInputEl:t,toggleBtnEl:a}=this.getDatePickerContext(e);a.disabled=!0,t.disabled=!0}enable(e){const{externalInputEl:t,toggleBtnEl:a}=this.getDatePickerContext(e);a.disabled=!1,t.disabled=!1}isDateInputInvalid(e){const{externalInputEl:t,minDate:a,maxDate:n}=this.getDatePickerContext(e),s=t.value;let r=!1;if(s){r=!0;const e=s.split("/"),[t,i,o]=e.map((e=>{let t;const a=parseInt(e,10);return Number.isNaN(a)||(t=a),t}));if(t&&i&&null!=o){const s=this.setDate(o,t-1,i);s.getMonth()===t-1&&s.getDate()===i&&s.getFullYear()===o&&4===e[2].length&&this.isDateWithinMinAndMax(s,a,n)&&(r=!1)}}return r}setCalendarValue(e,t){const a=this.parseDateString(t);if(a){const n=this.formatDate(a,Ae),{internalInputEl:s,externalInputEl:r}=this.getDatePickerContext(e);this.changeElementValue(s,t),this.changeElementValue(r,n)}}parseDateString(e,t=Ce,a=!1){let n,s,r,i,o;if(e){let l,c,d;if(t===Ae?[c,l,d]=e.split("/"):[d,l,c]=e.split("-"),d&&(o=parseInt(d,10),!Number.isNaN(o)&&(i=o,a&&(i=Math.max(0,i),d.length<3)))){const e=this.today().getFullYear();i=e-e%10**d.length+o}if(l&&(o=parseInt(l,10),Number.isNaN(o)||(s=o,a&&(s=Math.max(1,s),s=Math.min(12,s)))),s&&c&&null!=i&&(o=parseInt(c,10),!Number.isNaN(o)&&(r=o,a))){const e=this.setDate(i,s,0).getDate();r=Math.max(1,r),r=Math.min(e,r)}s&&r&&null!=i&&(n=this.setDate(i,s-1,r))}return n}today(){const e=new Date,t=e.getDate(),a=e.getMonth(),n=e.getFullYear();return this.setDate(n,a,t)}keepDateWithinMonth(e,t){return t!==e.getMonth()&&e.setDate(0),e}startOfMonth(e){const t=new Date(0);return t.setFullYear(e.getFullYear(),e.getMonth(),1),t}lastDayOfMonth(e){const t=new Date(0);return t.setFullYear(e.getFullYear(),e.getMonth()+1,0),t}addDays(e,t){const a=new Date(e.getTime());return a.setDate(a.getDate()+t),a}subDays(e,t){return this.addDays(e,-t)}addWeeks(e,t){return this.addDays(e,7*t)}subWeeks(e,t){return this.addWeeks(e,-t)}startOfWeek(e){const t=e.getDay();return this.subDays(e,t)}endOfWeek(e){const t=e.getDay();return this.addDays(e,6-t)}addMonths(e,t){const a=new Date(e.getTime()),n=(a.getMonth()+12+t)%12;return a.setMonth(a.getMonth()+t),this.keepDateWithinMonth(a,n),a}subMonths(e,t){return this.addMonths(e,-t)}addYears(e,t){return this.addMonths(e,12*t)}subYears(e,t){return this.addYears(e,-t)}setMonth(e,t){const a=new Date(e.getTime());return a.setMonth(t),this.keepDateWithinMonth(a,t),a}setYear(e,t){const a=new Date(e.getTime()),n=a.getMonth();return a.setFullYear(t),this.keepDateWithinMonth(a,n),a}min(e,t){let a=e;return te&&(a=t),new Date(a.getTime())}isSameYear(e,t){return e&&t&&e.getFullYear()===t.getFullYear()}isSameMonth(e,t){return this.isSameYear(e,t)&&e.getMonth()===t.getMonth()}isSameDay(e,t){return this.isSameMonth(e,t)&&e.getDate()===t.getDate()}keepDateBetweenMinAndMax(e,t,a){let n=e;return ea&&(n=a),new Date(n.getTime())}isDatesMonthOutsideMinOrMax(e,t,a){return this.lastDayOfMonth(e)a}isDatesYearOutsideMinOrMax(e,t,a){return this.lastDayOfMonth(this.setMonth(e,11))a}formatDate(e,t=Ce){const a=(e,t)=>`0000${e}`.slice(-t),n=e.getMonth()+1,s=e.getDate(),r=e.getFullYear();return t===Ae?[a(s,2),a(n,2),a(r,4)].join("/"):[a(r,4),a(n,2),a(s,2)].join("-")}setDate(e,t,a){const n=new Date(0);return n.setFullYear(e,t,a),n}isDateWithinMinAndMax(e,t,a){return e>=t&&(!a||e<=a)}changeElementValue(e,t=""){const a=e;a.value=t;const n=new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:{value:t}});a.dispatchEvent(n)}reconcileInputValues(e){const{internalInputEl:t,inputDate:a}=this.getDatePickerContext(e);let n="";a&&!this.isDateInputInvalid(e)&&(n=this.formatDate(a)),t.value!==n&&this.changeElementValue(t,n)}renderCalendar(e,t){const{datePickerEl:a,calendarEl:n,statusEl:s,selectedDate:r,maxDate:i,minDate:o,rangeDate:l}=this.getDatePickerContext(e),c=this.today();let d=t||c;const u=n.hidden,m=this.addDays(d,0),g=d.getMonth(),b=d.getFullYear(),D=this.subMonths(d,1),y=this.addMonths(d,1),f=this.formatDate(d),E=this.startOfMonth(d),v=this.isSameMonth(d,o),N=this.isSameMonth(d,i),I=r||d,O=l&&this.min(I,l),B=l&&this.max(I,l),U=l&&this.addDays(O,1),W=l&&this.subDays(B,1),R=Me[g],V=e=>{const t=[M],a=e.getDate(),n=e.getMonth(),s=e.getFullYear(),d=e.getDay(),u=this.formatDate(e);let g="-1";const b=!this.isDateWithinMinAndMax(e,o,i),p=this.isSameDay(e,r);this.isSameMonth(e,D)&&t.push(k),this.isSameMonth(e,m)&&t.push(A),this.isSameMonth(e,y)&&t.push(C),p&&t.push(x),this.isSameDay(e,c)&&t.push(w),l&&(this.isSameDay(e,l)&&t.push(L),this.isSameDay(e,O)&&t.push($),this.isSameDay(e,B)&&t.push(Y),this.isDateWithinMinAndMax(e,U,W)&&t.push(_)),this.isSameDay(e,m)&&(g="0",t.push(S));const f=Me[n],E=Se[d],v=document.createElement("button");return v.setAttribute("type","button"),v.setAttribute("tabindex",g),v.setAttribute("class",t.join(" ")),v.setAttribute("data-day",a),v.setAttribute("data-month",n+1),v.setAttribute("data-year",s),v.setAttribute("data-value",u),v.setAttribute("aria-label",h.escapeHTML`${a} ${f} ${s} ${E}`),v.setAttribute("aria-selected",p?"true":"false"),!0===b&&(v.disabled=!0),v.textContent=a,v};d=this.startOfWeek(E);const z=[];for(;z.length<28||d.getMonth()===g||z.length%7!=0;)z.push(V(d)),d=this.addDays(d,1);const K=this.listToGridHtml(z,7),ae=n.cloneNode();ae.dataset.value=f,ae.style.top=`${a.offsetHeight}px`,ae.hidden=!1,ae.innerHTML=h.escapeHTML`
`;const ne=document.createElement("table");ne.setAttribute("class",X),ne.setAttribute("role","presentation");const se=document.createElement("thead");ne.insertAdjacentElement("beforeend",se);const re=document.createElement("tr");se.insertAdjacentElement("beforeend",re);const ie=xe;Object.keys(ie).forEach((e=>{const t=document.createElement("th");t.setAttribute("class",te),t.setAttribute("scope","presentation"),t.setAttribute("aria-label",e),t.textContent=ie[e],re.insertAdjacentElement("beforeend",t)}));const oe=this.createTableBody(K);ne.insertAdjacentElement("beforeend",oe);ae.querySelector(ye).insertAdjacentElement("beforeend",ne),n.parentNode.replaceChild(ae,n),a.classList.add(p);const le=[];return this.isSameDay(r,m)&&le.push("Selected date"),u?(le.push("You can navigate by day using left and right arrows","Weeks by using up and down arrows","Months by using page up and page down keys","Years by using shift plus page up and shift plus page down","Home and end keys navigate to the beginning and end of a week"),s.textContent=""):le.push(`${R} ${b}`),s.textContent=le.join(". "),ae}displayPreviousYear(e){if(e.disabled)return;const{calendarEl:t,calendarDate:a,minDate:n,maxDate:s}=this.getDatePickerContext(e);let r=this.subYears(a,1);r=this.keepDateBetweenMinAndMax(r,n,s);const i=this.renderCalendar(t,r);let o=i.querySelector(de);o.disabled&&(o=i.querySelector(ye)),o.focus()}displayPreviousMonth(e){if(e.disabled)return;const{calendarEl:t,calendarDate:a,minDate:n,maxDate:s}=this.getDatePickerContext(e);let r=this.subMonths(a,1);r=this.keepDateBetweenMinAndMax(r,n,s);const i=this.renderCalendar(t,r);let o=i.querySelector(he);o.disabled&&(o=i.querySelector(ye)),o.focus()}displayNextMonth(e){if(e.disabled)return;const{calendarEl:t,calendarDate:a,minDate:n,maxDate:s}=this.getDatePickerContext(e);let r=this.addMonths(a,1);r=this.keepDateBetweenMinAndMax(r,n,s);const i=this.renderCalendar(t,r);let o=i.querySelector(me);o.disabled&&(o=i.querySelector(ye)),o.focus()}displayNextYear(e){if(e.disabled)return;const{calendarEl:t,calendarDate:a,minDate:n,maxDate:s}=this.getDatePickerContext(e);let r=this.addYears(a,1);r=this.keepDateBetweenMinAndMax(r,n,s);const i=this.renderCalendar(t,r);let o=i.querySelector(ue);o.disabled&&(o=i.querySelector(ye)),o.focus()}hideCalendar(e){const{datePickerEl:t,calendarEl:a,statusEl:n}=this.getDatePickerContext(e);t.classList.remove(p),a.hidden=!0,n.textContent=""}selectDate(e){if(e.disabled)return;const{datePickerEl:t,externalInputEl:a}=this.getDatePickerContext(e);this.setCalendarValue(e,e.dataset.value),this.hideCalendar(t),a.focus()}toggleCalendar(e){if(e.disabled)return;const{calendarEl:t,inputDate:a,minDate:n,maxDate:s,defaultDate:r}=this.getDatePickerContext(e);if(t.hidden){const e=this.keepDateBetweenMinAndMax(a||r||this.today(),n,s);this.renderCalendar(t,e).querySelector(le).focus()}else this.hideCalendar(e)}displayMonthSelection(e,t){const{calendarEl:a,statusEl:n,calendarDate:s,minDate:r,maxDate:i}=this.getDatePickerContext(e),o=s.getMonth(),l=null==t?o:t,c=Me.map(((e,t)=>{const a=this.setMonth(s,t),n=this.isDatesMonthOutsideMinOrMax(a,r,i);let c="-1";const d=[N],h=t===o;t===l&&(c="0",d.push(I)),h&&d.push(O);const u=document.createElement("button");return u.setAttribute("type","button"),u.setAttribute("tabindex",c),u.setAttribute("class",d.join(" ")),u.setAttribute("data-value",t),u.setAttribute("data-label",e),u.setAttribute("aria-selected",h?"true":"false"),!0===n&&(u.disabled=!0),u.textContent=e,u})),d=document.createElement("div");d.setAttribute("tabindex","-1"),d.setAttribute("class",z);const h=document.createElement("table");h.setAttribute("class",X),h.setAttribute("role","presentation");const u=this.listToGridHtml(c,3),m=this.createTableBody(u);h.insertAdjacentElement("beforeend",m),d.insertAdjacentElement("beforeend",h);const g=a.cloneNode();return g.insertAdjacentElement("beforeend",d),a.parentNode.replaceChild(g,a),n.textContent="Select a month.",g}selectMonth(e){if(e.disabled)return;const{calendarEl:t,calendarDate:a,minDate:n,maxDate:s}=this.getDatePickerContext(e),r=parseInt(e.dataset.value,10);let i=this.setMonth(a,r);i=this.keepDateBetweenMinAndMax(i,n,s);this.renderCalendar(t,i).querySelector(le).focus()}displayYearSelection(e,t){const{calendarEl:a,statusEl:n,calendarDate:s,minDate:r,maxDate:i}=this.getDatePickerContext(e),o=s.getFullYear(),l=null==t?o:t;let c=l;c-=c%ke,c=Math.max(0,c);const d=this.isDatesYearOutsideMinOrMax(this.setYear(s,c-1),r,i),u=this.isDatesYearOutsideMinOrMax(this.setYear(s,c+ke),r,i),m=[];let g=c;for(;m.length{r.insertAdjacentElement("beforeend",e)})),a.push(r)}return a}createTableBody=e=>{const t=document.createElement("tbody");return e.forEach((e=>{t.insertAdjacentElement("beforeend",e)})),t};adjustCalendar=e=>t=>{const{calendarEl:a,calendarDate:n,minDate:s,maxDate:r}=this.getDatePickerContext(this.el),i=e(n),o=this.keepDateBetweenMinAndMax(i,s,r);if(!this.isSameDay(n,o)){this.renderCalendar(a,o).querySelector(le).focus()}t.preventDefault()};handleUpFromDate=this.adjustCalendar((e=>this.subWeeks(e,1)));handleDownFromDate=this.adjustCalendar((e=>this.addWeeks(e,1)));handleLeftFromDate=this.adjustCalendar((e=>this.subDays(e,1)));handleRightFromDate=this.adjustCalendar((e=>this.addDays(e,1)));handleHomeFromDate=this.adjustCalendar((e=>this.startOfWeek(e)));handleEndFromDate=this.adjustCalendar((e=>this.endOfWeek(e)));handlePageDownFromDate=this.adjustCalendar((e=>this.addMonths(e,1)));handlePageUpFromDate=this.adjustCalendar((e=>this.subMonths(e,1)));handleShiftPageDownFromDate=this.adjustCalendar((e=>this.addYears(e,1)));handleShiftPageUpFromDate=this.adjustCalendar((e=>this.subYears(e,1)));handleMouseoverFromDate(e){if(e.disabled)return;const t=e.closest(ie),a=t.dataset.value,n=e.dataset.value;if(n===a)return;const s=this.parseDateString(n);this.renderCalendar(t,s).querySelector(le).focus()}adjustMonthSelectionScreen=e=>t=>{const a=t.target,n=parseInt(a.dataset.value,10),{calendarEl:s,calendarDate:r,minDate:i,maxDate:o}=this.getDatePickerContext(a),l=this.setMonth(r,n);let c=e(n);c=Math.max(0,Math.min(11,c));const d=this.setMonth(r,c),h=this.keepDateBetweenMinAndMax(d,i,o);if(!this.isSameMonth(l,h)){this.displayMonthSelection(s,h.getMonth()).querySelector(Ee).focus()}t.preventDefault()};handleUpFromMonth=this.adjustMonthSelectionScreen((e=>e-3));handleDownFromMonth=this.adjustMonthSelectionScreen((e=>e+3));handleLeftFromMonth=this.adjustMonthSelectionScreen((e=>e-1));handleRightFromMonth=this.adjustMonthSelectionScreen((e=>e+1));handleHomeFromMonth=this.adjustMonthSelectionScreen((e=>e-e%3));handleEndFromMonth=this.adjustMonthSelectionScreen((e=>e+2-e%3));handlePageDownFromMonth=this.adjustMonthSelectionScreen((()=>11));handlePageUpFromMonth=this.adjustMonthSelectionScreen((()=>0));handleMouseoverFromMonth(e){if(e.disabled)return;if(e.classList.contains(I))return;const t=parseInt(e.dataset.value,10);this.displayMonthSelection(e,t).querySelector(Ee).focus()}adjustYearSelectionScreen=e=>t=>{const a=t.target,n=parseInt(a.dataset.value,10),{calendarEl:s,calendarDate:r,minDate:i,maxDate:o}=this.getDatePickerContext(a),l=this.setYear(r,n);let c=e(n);c=Math.max(0,c);const d=this.setYear(r,c),h=this.keepDateBetweenMinAndMax(d,i,o);if(!this.isSameYear(l,h)){this.displayYearSelection(s,h.getFullYear()).querySelector(ve).focus()}t.preventDefault()};handleUpFromYear=this.adjustYearSelectionScreen((e=>e-3));handleDownFromYear=this.adjustYearSelectionScreen((e=>e+3));handleLeftFromYear=this.adjustYearSelectionScreen((e=>e-1));handleRightFromYear=this.adjustYearSelectionScreen((e=>e+1));handleHomeFromYear=this.adjustYearSelectionScreen((e=>e-e%3));handleEndFromYear=this.adjustYearSelectionScreen((e=>e+2-e%3));handlePageUpFromYear=this.adjustYearSelectionScreen((e=>e-ke));handlePageDownFromYear=this.adjustYearSelectionScreen((e=>e+ke));handleMouseoverFromYear(e){if(e.disabled)return;if(e.classList.contains(U))return;const t=parseInt(e.dataset.value,10);this.displayYearSelection(e,t).querySelector(ve).focus()}tabHandler(e){const t=t=>{const{calendarEl:a}=this.getDatePickerContext(t),n=((e,t)=>{if("string"!=typeof e)return[];var a;t&&(a=t)&&"object"==typeof a&&1===a.nodeType||(t=window.document);const n=t.querySelectorAll(e);return Array.prototype.slice.call(n)})(e,a),s=n.length-1,r=n[0],i=n[s],o=n.indexOf(document.activeElement);return{focusableElements:n,isNotFound:-1===o,firstTabStop:r,isFirstTab:0===o,lastTabStop:i,isLastTab:o===s}};return{tabAhead(e){const{firstTabStop:a,isLastTab:n,isNotFound:s}=t(e.target);(n||s)&&(e.preventDefault(),a.focus())},tabBack(e){const{lastTabStop:a,isFirstTab:n,isNotFound:s}=t(e.target);(n||s)&&(e.preventDefault(),a.focus())}}}datePickerTabEventHandler=this.tabHandler(we);monthPickerTabEventHandler=this.tabHandler($e);yearPickerTabEventHandler=this.tabHandler(Ye);datePickerEvents(e){const t=this;e.addEventListener("click",(function(a){if(a.target.classList.contains(f)&&t.toggleCalendar(a.target),a.target.classList.contains(M)&&t.selectDate(a.target),a.target.classList.contains(N)&&t.selectMonth(a.target),a.target.classList.contains(B)&&t.selectYear(a.target),a.target.classList.contains(F)&&t.displayPreviousMonth(a.target),a.target.classList.contains(j)&&t.displayNextMonth(a.target),a.target.classList.contains(T)&&t.displayPreviousYear(a.target),a.target.classList.contains(P)&&t.displayNextYear(a.target),a.target.classList.contains(R)&&t.displayPreviousYearChunk(a.target),a.target.classList.contains(V)&&t.displayNextYearChunk(e.target),a.target.classList.contains(q)){t.displayMonthSelection(e).querySelector(Ee).focus()}if(a.target.classList.contains(H)){t.displayYearSelection(e).querySelector(ve).focus()}})),e.addEventListener("keyup",(function(t){if(t.target.classList.contains(E)){const a=e.dataset.keydownKeyCode;`${t.keyCode}`!==a&&t.preventDefault()}})),e.addEventListener("keydown",(function(e){if(e.target.classList.contains(y)&&(e.target.dataset.keydownKeyCode=e.keyCode),e.target.classList.contains(M))switch(e.key){case"Up":case"ArrowUp":t.handleUpFromDate(e);break;case"Down":case"ArrowDown":t.handleDownFromDate(e);break;case"Left":case"ArrowLeft":t.handleLeftFromDate(e);break;case"Right":case"ArrowRight":t.handleRightFromDate(e);break;case"Home":t.handleHomeFromDate(e);break;case"End":t.handleEndFromDate(e);break;case"PageDown":t.handlePageDownFromDate(e);break;case"PageUp":t.handlePageUpFromDate(e);break;case"Shift+PageDown":t.handleShiftPageDownFromDate(e);break;case"Shift+PageUp":t.handleShiftPageUpFromDate(e);break;case"Tab":t.datePickerTabEventHandler.tabAhead(e);break;case"Escape":t.handleEscapeFromCalendar(e)}if(e.target.classList.contains(G))switch(e.key){case"Tab":t.datePickerTabEventHandler.tabAhead(e);break;case"Shift+Tab":t.datePickerTabEventHandler.tabBack(e)}if(e.target.classList.contains(N))switch(e.key){case"Up":case"ArrowUp":t.handleUpFromMonth(e);break;case"Down":case"ArrowDown":t.handleDownFromMonth(e);break;case"Left":case"ArrowLeft":t.handleLeftFromMonth(e);break;case"Right":case"ArrowRight":t.handleRightFromMonth(e);break;case"Home":t.handleHomeFromMonth(e);break;case"End":t.handleEndFromMonth(e);break;case"PageDown":t.handlePageDownFromMonth(e);break;case"PageUp":t.handlePageUpFromMonth(e);break;case"Shift+Tab":case"Tab":e.preventDefault()}if(e.target.classList.contains(z))switch(e.key){case"Tab":t.monthPickerTabEventHandler.tabAhead(e);break;case"Shift+Tab":t.monthPickerTabEventHandler.tabBack(e)}if(e.target.classList.contains(B))switch(e.key){case"Up":case"ArrowUp":t.handleUpFromYear(e);break;case"Down":case"ArrowDown":t.handleDownFromYear(e);break;case"Left":case"ArrowLeft":t.handleLeftFromYear(e);break;case"Right":case"ArrowRight":t.handleRightFromYear(e);break;case"Home":t.handleHomeFromYear(e);break;case"End":t.handleEndFromYear(e);break;case"PageDown":t.handlePageDownFromYear(e);break;case"PageUp":t.handlePageUpFromYear(e);break;case"Shift+Tab":case"Tab":e.preventDefault()}e.target.classList.contains(u)&&"Escape"===e.key&&t.handleEscapeFromCalendar(e)})),e.addEventListener("focusout",(function(a){e.contains(a.relatedTarget)||t.hideCalendar(e)})),e.addEventListener("input",(function(a){a.target.classList.contains(y)&&(t.reconcileInputValues(e),t.updateCalendarIfVisible(e))})),"undefined"!=typeof navigator&&(navigator.userAgent.match(/(iPod|iPhone|iPad)/g)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&!window.MSStream||e.addEventListener("mouseover",(function(a){a.target.classList.contains(ce)&&t.handleMouseoverFromDate(e),a.target.classList.contains(ge)&&t.handleMouseoverFromMonth(e),a.target.classList.contains(be)&&t.handleMouseoverFromYear(e)}))}}_e.init(m);const Te="click";class Fe extends t{constructor(e){if(super(),!e)return;this.header=e,this.source={globalSearch:this.header.querySelector(".govcy-global-search"),mobileMenu:this.header.querySelector(".govcy-mobile-menu")},this.destination={globalSearch:this.header.querySelector(".govcy-header-search-area"),mobileMenu:this.header.querySelector(".govcy-mainmenu")},this.source.globalSearch&&this.source.globalSearch.addEventListener(Te,(e=>{e.preventDefault(),this._toggle(this.source.globalSearch,this.destination.globalSearch)})),this.source.mobileMenu&&this.source.mobileMenu.addEventListener(Te,(e=>{e.preventDefault(),this._toggle(this.source.mobileMenu,this.destination.mobileMenu)}));this.header.querySelectorAll(".govcy-expand-btn").forEach((e=>{"#"==e.getAttribute("href")&&e.addEventListener("click",(t=>{t.preventDefault();window.matchMedia("(max-width: 767px)").matches&&e.classList.toggle("open")})),e.addEventListener("keydown",(t=>{9!=t.keyCode||e.classList.contains("open")||(t.preventDefault(),e.classList.add("open"))}))}));this.header.querySelectorAll(".govcy-expand-btn i").forEach((e=>{"#"!=e.parentElement.getAttribute("href")&&e.addEventListener("click",(t=>{t.preventDefault();window.matchMedia("(max-width: 767px)").matches&&e.parentElement.classList.toggle("open")})),e.addEventListener("keydown",(t=>{9!=t.keyCode||e.parentElement.classList.contains("open")||(t.preventDefault(),e.parentElement.classList.add("open"))}))}));this.header.querySelectorAll(".govcy-dropdown").forEach((e=>{e.addEventListener("mouseover",(()=>{e.querySelector(".govcy-expand-btn").setAttribute("aria-expanded","true")})),e.addEventListener("mouseout",(()=>{e.querySelector(".govcy-expand-btn").setAttribute("aria-expanded","false")})),e.addEventListener("focusin",(()=>{e.querySelector(".govcy-expand-btn").setAttribute("aria-expanded","true")})),e.addEventListener("focusout",(()=>{e.querySelector(".govcy-expand-btn").setAttribute("aria-expanded","false")}))}));const t=window.matchMedia("(max-width: 767px)");addEventListener("resize",(()=>{const e=this.header.querySelectorAll(".govcy-desktop-menu-only"),a=this.header.querySelectorAll(".govcy-mobile-menu-only");t.matches?(e.forEach((e=>{e.hidden=!0})),a.forEach((e=>{e.hidden=!1}))):(e.forEach((e=>{e.hidden=!1})),a.forEach((e=>{e.hidden=!0})))})),dispatchEvent(new Event("resize"))}_toggle(e,t){for(let e in this.destination)this.destination[e]!==t&&this._close(this.source[e],this.destination[e]);e&&t&&(e.classList.toggle("open"),t.classList.toggle("open"))}_close(e,t){e&&t&&(e.classList.remove("open"),t.classList.remove("open"),e.firstElementChild.firstElementChild.classList.remove("open"))}}Fe.init(".govcy-header");class Pe extends t{constructor(e){if(super(),!e)return;const t=new AbortController,a=e.closest("form");a&&a.addEventListener("submit",(()=>{t.abort()})),navigator.credentials.get({otp:{transport:["sms"]},signal:t.signal}).then((t=>{e.value=t.code,a&&a.submit()})).catch((e=>{console.log(e)})),console.log("Mobile OTP Loaded")}}"OTPCredential"in window&&Pe.init('input[autocomplete="one-time-code"]');const je="active",qe="show";class He extends t{constructor(e){if(super(),!e)return;const t=document.querySelector(e.dataset.govcyTarget);t&&(this.srcElement=e,this.targetElement=t,this.srcElement.addEventListener("click",(e=>{e.preventDefault(),this._activateTab()})))}_activateTab(){this.srcElement.closest(".govcy-tabs").querySelectorAll(".govcy-tab-link").forEach((e=>{e.classList.remove(je),e.setAttribute("aria-selected",!1)})),this.srcElement.classList.add(je),this.srcElement.setAttribute("aria-selected",!0);this.targetElement.parentElement.querySelectorAll(".govcy-tab-pane").forEach((e=>{e.getAttribute("id")==this.targetElement.getAttribute("id")?(e.classList.add(je),e.classList.add(qe)):(e.classList.remove(je),e.classList.remove(qe))}))}}He.init(".govcy-tab-link");class Ne extends t{constructor(){super(),this.radioInputs=document.querySelectorAll(".govcy-radio-input"),this.radioInputs.forEach((e=>{e.addEventListener("change",this.handleInputChange.bind(this))}))}toggleConditionalContact(e){document.querySelectorAll(".govcy-radio__conditional").forEach((t=>{t.id!==e?t.classList.add("govcy-radio__conditional--hidden"):t.classList.remove("govcy-radio__conditional--hidden")}))}handleInputChange(e){const t=e.target.getAttribute("data-aria-controls");this.toggleConditionalContact(t)}}return Ne.init(".govcy-radio-input"),e.Accordion=r,e.CharacterCount=o,e.Collapsable=d,e.ConditionalContactToggler=Ne,e.DatePicker=_e,e.HeaderMenu=Fe,e.MobileOTP=Pe,e.Tab=He,e}({});